import Page
from Page import Personal
from Base.Base import Base
from selenium.webdriver.common.by import By


class PersonalQRcode(Base):
    """
     二维码界面
    """

    def __init__(self, driver):
        Base.__init__(self, driver)

        # 页面_变量名_元素类型
        # 左侧的home键
        self.qrcode_home_btn = (By.XPATH, Personal.RESOURCE_ID.format("ivHome"))

        # 左侧的返回键
        self.qrcode_back_btn = (By.XPATH, Personal.RESOURCE_ID.format('ivBack'))

        # 数字钥匙按钮
        self.qrcode_number_key_btn = (By.XPATH, Page.TEXT.format("数字钥匙"))

        # 数字二维码
        self.qrcode_number_qr_img = (By.XPATH, Personal.RESOURCE_ID.format("iv_key_and_remote"))

        # 数字钥匙文案
        self.qrcode_number_key_title_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_key_and_remote"))

        # 远程控制按钮
        self.qrcode_control_btn = (By.XPATH, Page.TEXT.format("远程控制"))

        # 远程控制二维码
        self.qrcode_control_qr_img = (By.XPATH, Personal.RESOURCE_ID.format("iv_key_and_remote"))

        # 远程控制文案
        self.qrcode_control_content_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_key_and_remote"))

        # 全息奔腾按钮
        self.qrcode_3d_btn = (By.XPATH, Page.TEXT.format("全息奔腾"))

        # 全息步骤1图标
        self.qrcode_3d_step_one_icon = (By.XPATH, Personal.RESOURCE_ID.format("tv_bg_step_one"))

        # 全息步骤1文案(标题)
        self.qrcode_3d_step_one_title_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_step_one_load_app"))

        # 步骤1二维码
        self.qrcode_3d_step_one_qr_img = (By.XPATH, Personal.RESOURCE_ID.format("iv_load_app_qr_code"))

        # 二维码步骤1内容
        self.qrcode_3d_step_one_content_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_step_one_desc"))

        # 全息步骤2图标
        self.qrcode_3d_step_two_icon = (By.XPATH, Personal.RESOURCE_ID.format("tv_bg_step_two"))

        # 全息步骤2文案(标题)
        self.qrcode_3d_step_two_title_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_step_tow_scan_code"))

        # 步骤2二维码
        self.qrcode_3d_step_two_qr_img = (By.XPATH, Personal.RESOURCE_ID.format("iv_phone_app_qr_code"))

        # 二维码步骤2内容
        self.qrcode_3d_step_two_content_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_step_two_desc"))

        # 全息步骤3图标
        self.qrcode_3d_step_three_icon = (By.XPATH, Personal.RESOURCE_ID.format("tv_bg_step_three"))

        # 全息步骤3文案(标题)
        self.qrcode_3d_step_three_title_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_step_three_bind_finish"))

        # 二维码步骤3内容
        self.qrcode_3d_step_three_content_text = (By.XPATH, Personal.RESOURCE_ID.format("tv_step_three_desc"))

    def click_home(self):
        """
        点击左侧的home键

        :return:None
        """
        self.click_element(self.qrcode_home_btn)

    def click_back(self):
        """
        点击左侧的back键

        :return:None
        """
        self.click_element(self.qrcode_back_btn)

    def click_number_key(self):
        """
        点击数字钥匙按钮

        :return: None
        """
        self.click_element(self.qrcode_number_key_btn)

    def get_number_qr(self):
        """
        获取数字钥匙二维码

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_number_qr_img)

    def get_number_key_title(self):
        """
        获取数字钥匙文案

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_number_key_title_text)

    def click_control(self):
        """
        点击远程控制按钮

        :return: None
        """
        self.click_element(self.qrcode_control_btn)

    def get_control_qr(self):
        """
        获取远程控制二维码

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_control_qr_img)

    def get_control_content(self):
        """
        获取远程控制文案

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_control_content_text)

    def click_3d(self):
        """
        点击全息奔腾

        :return: None
        """
        self.click_element(self.qrcode_3d_btn)

    def get_3d_step_one(self):
        """
        获取全息步骤1图标

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_one_icon)

    def get_3d_step_one_title(self):
        """
        获取步骤1文案

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_one_title_text)

    def get_3d_step_one_qr(self):
        """
        获取步骤1二维码

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_one_qr_img)

    def get_3d_step_one_content(self):
        """
        获取步骤1内容

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_one_content_text)

    def get_3d_step_two(self):
        """
        获取全息步骤2图标

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_two_icon)

    def get_3d_step_two_title(self):
        """
        获取步骤2文案

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_two_title_text)

    def get_3d_step_two_qr(self):
        """
        获取步骤2二维码

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_two_qr_img)

    def get_3d_step_two_content(self):
        """
        获取步骤2内容

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_two_content_text)

    def get_3d_step_three(self):
        """
        获取全息步骤3图标

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_three_icon)

    def get_3d_step_three_title(self):
        """
        获取步骤3文案

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_three_title_text)

    def get_3d_step_three_content(self):
        """
        获取步骤3内容

        :return: 获取元素
        """
        return self.find_element_o(self.qrcode_3d_step_three_content_text)

    def is_display_personal_qr_code(self):
        """
        是否进入二维码界面

        :return: bool
        """
        return self.is_display(self.qrcode_number_key_btn)
